﻿cmake_minimum_required(VERSION 2.8)

project(PIVideoReader)

LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../cmake_module)

include(cmake/PICMake.cmake)


if(NOT CMAKE_BUILD_TYPE)
  set(CMAKE_BUILD_TYPE RELEASE)
endif()

message("CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")

list(APPEND CMAKE_CXX_FLAGS "-Wl,-rpath,.:lib:../lib")
add_definitions(-DHAVE_POSIX_OPENPT)

if(CMAKE_BUILD_TYPE STREQUAL "RELEASE")
    add_definitions(-O3)
    message("Build with -O3")
    #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--retain-symbols-file=${CMAKE_SOURCE_DIR}/cmake/static_export.sym -Wl,--version-script=${CMAKE_SOURCE_DIR}/cmake/shared_export.map")
endif()

pi_collect_packages(VERBOSE REQUIRED System PIL OpenCV FFMPEG)

pi_add_target(PIVideoReaderFC SHARED PIFCVR/src REQUIRED PIL FFMPEG)
pi_add_target(PIVideoReaderCV SHARED OpenCV/src REQUIRED PIL OpenCV)
pi_add_target(PIVideoReaderV4L2 SHARED V4L2/src MODULES v4l2 REQUIRED PIL OpenCV)
pi_add_target(TestPIVideoReader BIN test MODULES OpenCV REQUIRED PIL)


pi_report_targets()

